<?
/*
 *   Pmail easy way to send emails
 *   Copyright (C) 2009  Felipe Theodoro Gonçalves (www.ftgoncalves.com)
 *
 *   This program is free software: you can redistribute it and/or modify
 *	 it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
?>
<div id="page">
	<p class="ind"><?= $html->link(__d('pmail', 'Send email', true), array('plugin' => 'pmail', 'controller' => 'mails', 'action' => 'index')); ?> > <?= __d('pmail', 'Layout') ?></p>
	<h2><?= __d('pmail', 'Create a new layer') ?></h2>
<div id="help" class="hide">
		<p>
			For the use of `labels`<br/>
			<?php
				foreach($labels as $label){
					echo $label['Label']['name'] . ' -- ' . $label['Label']['description'] . '<br/>';
				}
			?>
		</p>
	</div>
	<? if(isset($this->params['pass'][0])): ?>
		<form action="<?= $html->url(array('plugin' => 'pmail', 'controller' => 'mails', 'action' => 'save_layer', 'id' => $this->params['pass'][0])); ?>" method="post" enctype="application/x-www-form-urlencoded">
	<? else: ?>
		<form action="<?= $html->url(array('plugin' => 'pmail', 'controller' => 'mails', 'action' => 'save_layer')); ?>" method="post" enctype="application/x-www-form-urlencoded">
	<? endif; ?>
		<fieldset>
			<legend><?= __d('pmail', 'data of new layout') ?></legend>
			<p>
				<label for="identifier"><?= __d('pmail', 'Identifier') ?></label>
				<br/>
				<?= $form->text('Layer.identifier', array('class' => 'middle', 'maxlength' => 18)); ?>
			</p>
			<p>
				<label for="description"><?= __d('pmail', 'Description') ?></label>
				<br/>
				<?= $form->text('Layer.description', array('class' => 'big', 'maxlength' => 40)); ?>
			</p>
			<p>
				<label for="message"><?= __d('pmail', 'Message') ?> - HTML</label> <a id="bhelp" href="javascript:void(0);"><?= $html->image('/pmail/img/duvida.gif', array('border' => 0)) ?></a>
				<br/>
				<?= $form->textarea('Layer.html'); ?>
			</p>
			<p>
				<?= $form->submit(__d('pmail', 'save', true), array('value' => 'Save', 'class' => 'button')) ?>
			</p>
		</fieldset>
	</form>
</div>
<div id="sidebar">
	<h4><?= __d('pmail', 'Coments') ?></h4>
	<p><?= __d('pmail', 'Create or update a layout for the email') ?>.</p>
	<?= $this->requestAction('/pmail/mails/menu'); ?>
	<?= $this->renderElement('recommended/links'); ?>
</div>
<div class="clear"></div>
<script type="text/javascript">
	$('#bhelp').click(function(){
		$('#help').toggle();
	});
</script>
<?= $this->renderElement('panel/fckeditor', array('name' => 'data[Layer][html]')); ?>